<?php
/**
 *
 */
namespace app\common\query;
use app\common\model\Logistics as LogisticsModel;
use app\common\cache\CacheData;
class Logistics
{
    protected $resultSetType = 'collection';
    /**
     * 查询所有物流公司
     * @return [type] [description]
     */
    public static function getDatas($where=[],$field=''){
        $model = new LogisticsModel;
        $data = $model->where($where)->field($field)->select();
        return $data;
    }


    /**
     * 查询单个物流信息
     * @return [type] [description]
     */
    public static function getOne($id='',$field=''){
        $model = new LogisticsModel;
        return $model->where(['id'=>$id])->field($field)->find();
    }

    /**
     * 查询单个物流名称
     * @return [type] [description]
     */
    public static function getTitle($id=''){
        $model = new LogisticsModel;
        return $model->where(['id'=>$id])->value('title');
    }

    /**
     * 添加物流公司信息
     * @return [type] [description]
     */
    public static function addOneData($data=[]){
        $model = new LogisticsModel;
        return $model->save($data);
    }

    /**
     * 删除物流公司信息
     * @return [type] [description]
     */
    public static function deleteOneData($data=[]){
        $model = new LogisticsModel;
        return $model->delete($data);
    }

    /**
     * 更新物流公司信息
     * @return [type] [description]
     */
    public function saveOneData($data=[],$id=''){
        $model = new LogisticsModel;
        return $model->save($data,['id' => $id]);
    }
}